<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:a4j="http://richfaces.org/a4j"
	xmlns:rich="http://richfaces.org/rich"
	xmlns:c="http://java.sun.com/jstl/core"
	xmlns:p="http://primefaces.prime.com.tr/ui">

		<h:form id="idNomePerifericoMBForm">
			<p:panel>
				<p:messages globalOnly="true" rendered="true"/>
				<f:facet name="header">
					<h:outputText value="#{msg.nomePeriferico}" />
				</f:facet>

				<fieldset id="legend_area"><legend id="legend"><h:outputLabel
					value="#{msg.nomePerifericoDados}" /></legend> 
					<h:panelGrid columns="2">
						<h:panelGroup>
							<br/>
							<h:outputLabel value="#{msg.nome}" for="idNomeNomePer" />
							<span class="req"> *</span>
						</h:panelGroup>
						<h:panelGroup>
							<rich:message for="idNomeNomePer" styleClass="mensagem_erro_campo" /><br/>
							<h:inputHidden value="#{nomePerifericoMB.nomePeriferico.id}"/>
							<h:inputText id="idNomeNomePer"
								value="#{nomePerifericoMB.nomePeriferico.nome}" size="25" maxlength="25"
								onkeyup="javascript:toUpperCase(this);" required="true"
								requiredMessage="#{msg.campoObrigatorio}">
								<rich:ajaxValidator event="onblur" />
							</h:inputText>
						</h:panelGroup>

						<h:panelGroup>
							<br/>
							<h:outputLabel value="#{msg.marca}" for="idMarcaNomePer" />
						</h:panelGroup>
						<h:panelGroup>
							<br/>
							<h:inputText id="idMarcaNomePer"
								value="#{nomePerifericoMB.nomePeriferico.marca}" size="45" maxlength="45"
								onkeyup="javascript:toUpperCase(this);">
							</h:inputText>
						</h:panelGroup>
						
						<h:panelGroup>
							<br/>
							<h:outputLabel value="#{msg.nome}" for="idTipoNomePer" /><span class="req"> *</span>
						</h:panelGroup>
						<h:panelGroup>
								<rich:message for="idTipoNomePer" styleClass="mensagem_erro_campo"/><br/>
								<h:selectOneMenu id="idTipoNomePer" value="#{nomePerifericoMB.nomePeriferico.tipoNome}">
									<f:selectItems value="#{nomePerifericoMB.tipoNomeOpts}" />
								</h:selectOneMenu>
						</h:panelGroup>
					</h:panelGrid>
				</fieldset>
				<br />

				<h:panelGrid columns="2" width="100%" style="text-align:center;">
					<h:panelGroup>
						<a4j:commandButton value="#{msg.botaoSalvar}"
							action="#{nomePerifericoMB.save}" reRender="idNomePerifericoMBForm, nomePerifericoList"
							style="text-align:center;" />
						<rich:spacer width="15px" />
						<a4j:commandButton value="#{msg.botaoAtualizar}"
							action="#{nomePerifericoMB.atualiza}" style="text-align:center;" reRender="idNomePerifericoMBForm, nomePerifericoList, mensagens"/>
						<rich:spacer width="15px"/>
						<a4j:commandButton value="#{msg.botaoLimpar}"
							action="#{nomePerifericoMB.limpar}" reRender="idNomePerifericoMBForm, nomePerifericoList, mensagens"
							style="text-align:center;" />
					</h:panelGroup>
				</h:panelGrid>
			</p:panel>

		</h:form>
		<br />
		<h:form>
			<p:panel>
				<a4j:commandButton reRender="idNomePerifericoMBForm" value="#{msg.alterar}" action="#{nomePerifericoMB.listaToFormNomePeriferico}"/>
				<h:commandButton onclick="return confirm('Deseja excluir o registro?')" value="#{msg.excluir}" action="#{nomePerifericoMB.remove}" reRender="nomePerifericoList"/>
				<p:dataTable id="nomePerifericoList" var="nomePeriferico" value="#{nomePerifericoMB.nomePerifericoList}" paginator="true" rows="6" 
					selection="#{nomePerifericoMB.nomePerifericoSelectedList}" selectionMode="multiple">
					
					<p:column filterBy="#{nomePeriferico.nome}" sortBy="#{nomePeriferico.nome}" width="200">
						<f:facet name="header">
							<h:outputText value="#{msg.nome}" />
						</f:facet>
						<h:outputText value="#{nomePeriferico.nome}" />
					</p:column>
					<p:column filterBy="#{nomePeriferico.marca}" sortBy="#{nomePeriferico.marca}" width="250">
						<f:facet name="header">
							<h:outputText value="#{msg.marca}" />
						</f:facet>
						<h:outputText value="#{nomePeriferico.marca}" />
					</p:column>
				</p:dataTable>
				<h:outputText value="#{msg.exportarTodosDados}" style="font-weight:bold"/>:
				<h:commandLink>
					<p:graphicImage value="/images/excel.png" style="border:0;"/>
					<p:dataExporter type="xls" target="nomePerifericoList" fileName="#{msg.nomePeriferico}" />
				</h:commandLink>
				<h:commandLink>
					<p:graphicImage value="/images/pdf.png" style="border:0;"/>
					<p:dataExporter type="pdf" target="nomePerifericoList" fileName="#{msg.nomePeriferico}"/>
				</h:commandLink><rich:spacer width="10px"/>

				<h:outputText value="#{msg.exportarDadosPagina}" style="font-weight:bold"/>:
				<h:commandLink>
					<p:graphicImage value="/images/excel.png" style="border:0;"/>
					<p:dataExporter type="xls" target="nomePerifericoList" fileName="#{msg.nomePeriferico}" />
				</h:commandLink>
				<h:commandLink>
					<p:graphicImage value="/images/pdf.png" style="border:0;"/>
					<p:dataExporter type="pdf" target="nomePerifericoList" fileName="#{msg.nomePeriferico}"/>
				</h:commandLink>
			</p:panel>
		</h:form>		
</ui:composition>